In the field of computer graphics, pictorial information is often stored as a bitmap, in which each pixel of an image corresponds to 1 or more bits in the bitmap. Monochrome bitmaps require only 1 bit per pixel (or "bpp"); color bitmaps require additional bits to indicate the color of each pixel. Typically, color pixels are represented by 8, 16, or 24 bits per pixel.
Often all or part of a bitmap must be moved from one location in a computer's memory (the "source" location) to another location (the "destination" location). Transfers of this type are called bitmap block transfers, or "blt"s for short, and are typically carried out by a computer's operating system in response to a function call from an application program. For example, an application program may have "drawn" a figure on a bitmap in a source memory location by changing the numeric values of the bits in the bitmap. To display the figure rapidly on the screen of a display device, the bitmap is block transferred (or "blitted") from the source memory location to the video display (destination) memory location. A display device associated with the video display memory then displays the bitmap containing the figure. The video display memory is also commonly referred to as the screen memory or frame buffer for the display device.
Often there is a need to change a bitmap as it is transferred from the source to the destination in memory. These changes might be required for a number of reasons. First, the source and destination may have different color formats for their bitmaps. For example, a bitmap in the source may represent color information with 8 bits per pixel, while a bitmap in the destination may represent color information with 16 bits per pixel. In such a case, the 8 bit per pixel information in a source bitmap must be transformed into 16 bit per pixel information in a destination bitmap at the time the block transfer occurs. (This change in format is referred to as a "conversion".) Second, even if the color formats are identical, the color values in the source bitmap may have to be changed as the bitmap is transferred to the destination. For example, if a program draws a red triangle on a source bitmap and the destination contains a yellow bitmap, the program may want the triangle to appear orange in the destination bitmap (combining yellow and red), or red (the color used to draw the triangle). It is convenient to combine the red and yellow into orange during the transfer. (This operation is referred to as "combining".) Third, the source and destination memory locations might be different sizes. For example, the source location may be a rectangle of dimension 10.times.10, but a program might want the rectangle transferred to the video display memory location and displayed with dimensions 20.times.20. Accommodating this change in size is also done during the block transfer. (This operation is referred to as "stretching".)
These block transfers of data between memory locations should be as fast as possible, since they occur frequently and involve the movement of large amounts of data. For example, in the process of opening different windows in a graphical use interface, many data blocks are transferred into the display memory to produce the windows' color, text and graphics. Therefore the slower the rate of transfer, the slower the rate at which the computer system operates.
Prior approaches for data block transfers have been inefficient. In an initial approach, the functions that performed the various operations of block transfer, converting and combining were called once for each byte of the data block to be transferred. (A byte is a group of bits such as 8, and is normally the smallest addressable segment of data in a memory. As used herein, the term "byte" means one or more bits that can be addressed as a single unit.) Data block transfers typically involve thousands of bytes. Because function calls are relatively slow, this results in a very slow transfer of the data block as the block transfer functions are called thousands of times for a data block transfer.
It was thereafter recognized that the repetitive function calls could be eliminated by creating a function that includes a run-time code compiler. The compiler generates code that imbeds the required byte transfer operation within a loop. In this second approach, a block transfer function with its code compiler must only be called once to transfer the data block from a source memory location to a destination memory location. While it takes additional time to generate the code, that additional time is more than offset by the time savings from eliminating the thousands of additional, repetitive function calls previously required.
Although the second approach is a distinct improvement over the first, both suffer from a fundamental drawback: the block transfer still occurs byte by byte. For a thousand byte block transfer, for example, the loop within the block transfer function must still be executed a thousand times. While time required to call a function a thousand times has been eliminated, the time required to execute a loop a thousand times to transfer the data block byte by byte has not.
Accordingly, an object of this invention is to transfer a data block from a source to a destination in memory more rapidly than before. Another object of the invention is to reduce the time required for transferring the data block by transferring it in multiple-byte groups or words, that may be accommodated by a particular computer system. Still another object of the invention is transfer, combine or convert a data block rapidly through the generation of run-time code, with the code adapted for transferring the data in both bytes and multiple-byte words as needed for the most efficient transfer of the data block.